package com.tek.ding.faceding.ui.camera;

import android.content.Context;
import android.content.Intent;

import com.tek.ding.faceding.R;
import com.tek.ding.faceding.bean.Members;
import com.tek.ding.faceding.utils.opengl.carema.TextureController;
import com.tek.ding.faceding.utils.opengl.filter.Beauty;
import com.tek.ding.faceding.utils.opengl.filter.LookupFilter;

public class CameraOpenGLActivity extends CameraActivity {

    private static final String TYPE = "type";
    private static final String SHOP_MEMBER = "members";

    private LookupFilter mLookupFilter;
    private Beauty mBeautyFilter;

    public static void startActivity(Context context, Members members, int type) {
        context.startActivity(new Intent(context, CameraOpenGLActivity.class)
                .putExtra(SHOP_MEMBER, members)
                .putExtra(TYPE, type));
    }

    public static void startActivity(Context context, int type) {
        context.startActivity(new Intent(context, CameraOpenGLActivity.class).putExtra(TYPE, type));
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_camera_opengl;
    }

    @Override
    public void setMeiYan() {
        if (null != mLookupFilter)
            mLookupFilter.setIntensity(0.5f);
        if (null != mBeautyFilter)
            mBeautyFilter.setFlag(1);
    }

    @Override
    protected void onFilterSet(TextureController controller) {
        mLookupFilter = new LookupFilter(getResources());
        mLookupFilter.setMaskImage("lookup/purity.png");
        mLookupFilter.setIntensity(0.0f);
        controller.addFilter(mLookupFilter);
        mBeautyFilter = new Beauty(getResources());
        mBeautyFilter.setFlag(1);
        controller.addFilter(mBeautyFilter);
    }

}
